Skip to main content

Insight Messages

Insight Messages rendering

Rendering Insight Messages is done in two stages. First, the placeholders in the Insight Definition Content Template are replaced according to the mechanism described in the Content Rendering Engine section. For example:

{
"message":"Hi {{@r.UserRepository.PersonFirstName()}}, you've made a transaction for the amount of {{@e.Amount}} {{@e.Currency}}",
"deepLink": "/transaction-details?id={{@e.Id}}",
"deepLinkText": "Transaction details"
}

The above placeholders in curly brackets will be replaced as follows:

  • the @r.UserRepository.PersonFirstName() property will be replaced with the user name that is taken from the User repository
  • the @e.Amount, @e.Currency and @e.Id properties will be replaced with the amount, currency and id of the transaction, which are taken from the transaction event

The rendered above mode example can look like this:

{
"message":"Hi Joe, you've made a transaction for the amount of -17.00 EUR",
"deepLink": "/transaction-details?id=123",
"deepLinkText": "Transaction details"
}

In the second stage, the message for the Content Template is replaced. The data to be changed are taken from the first step, where the Data model has been rendered. For example:

{
"Content": "<p>{{message}}</p>",
"Link": "<p><a href=\"{{deepLink}}\">{{deepLinkText}}</a></p>
}

The above Content Template can be rendered as follows:

{
"Content": "<p>Hi Joe, you've made a transaction for the amount of -17.00 EUR</p>",
"Link": "<p><a href=\"/transaction-details?id=123\">Transaction details</a></p>
}

The rendered Insights Messages can be retrieved via Message Dispatcher or Feed API.

caution

Placeholders in Content Templates do not use any special prefixes, unlike Insights Definition Content Templates which require a prefix such as @ or #. See more at Content Rendering Engine section

info

For more information on adding and modifying Content Templates, see managing Content Templates section.